﻿using System.Web.Mvc;
using Mondial2014.Models.Context;
using Mondial2014.Models.Gambling;

namespace Mondial2014.Controllers
{
    public class GamblersController : Controller
    {
        private readonly Mondial2014DbContext m_Context = new Mondial2014DbContext();

        // GET: Gamblers
        public ActionResult Index()
        {
            return View(m_Context.Gamblers);
        }

        public ActionResult Create()
        {
            return View();
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id, Name")] Gambler gambler)
        {
            if (ModelState.IsValid)
            {
                m_Context.Gamblers.Add(gambler);
                m_Context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(gambler);
        }

        

    }
}